<template>
  <div>
    <router-view />
  </div>
</template>
<script setup lang="ts">
import { useSystemStore } from '@/store/modules/system'
import { defaultSettings } from '@/setting'
import { ElementPlusModifyEnum } from '@/enums/ElementPlusModifyEnum'
import { onMounted } from 'vue'

const systemStore = useSystemStore()

onMounted(() => {
  // 初始化主题色
  Object.keys(defaultSettings.settings.themeColor).forEach((key) => {
    const enumKey = key as ElementPlusModifyEnum // 类型断言将键转换为 ElementPlusModifyEnum 类型
    if (
      defaultSettings.settings.themeColor[enumKey] !==
      systemStore.settings.themeColor[enumKey]
    ) {
      systemStore.setThemeColor(
        enumKey,
        systemStore.settings.themeColor[enumKey],
      )
    }
  })
})
</script>

<style scoped lang="scss">
</style>
